package open3366pvp.as3.dataStruct
{
	import flash.utils.ByteArray;
	
	import open3366pvp.as3.Open3366PvpEvent;
	
	/**
	 * 获取某个区的所有房间信息 
	 * @author mandyxiong
	 * 
	 */	
	public class AstRoomProp implements IPvpInfo
	{
		public var gameId:uint;
		public var uid:String;
		public var zoneId:int;
		public var roomNum:uint;
		public var roomList:Array;
		
		public function parasData(data:ByteArray):void
		{
			uid = data.readUTFBytes(32);
			gameId = data.readUnsignedInt();
			zoneId = data.readInt();
			roomList = [];
			roomNum = data.readInt();
			for (var i:int = 0; i < roomNum; i++ )
			{
				var roomInfo:RoomInfo = new RoomInfo(data);
				roomList.push(roomInfo);
			}
		}
		
		public function get eventType():String
		{
			return Open3366PvpEvent.GET_ROOM_LIST;
		}
		
		public function toString():String
		{
			var len:int = roomList.length;
			var str:String = ("   总房间数：" + len + "\n");
			str += "uid :" + uid + ", gameId" + gameId + ", zoneId" + zoneId + "\n";
			for(var i:int = 0; i < len; i++)
			{
				str += ("roomId:" + roomList[i].roomId + ", userTotalCount:" + roomList[i].roomUserTotalCount +  ", userNotInTableCount: " + roomList[i].roomUserNotInTableCount + ", bufferSize:" + roomList[i].bufferSize + ", szBufferContent:" + roomList[i].bufferData.toString() + ";\n");
			}
			return "获取游戏所有房间成功！！" + str;
		}
	}
}